package com.j259.j.poi;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

import java.io.FileInputStream;
import java.io.IOException;

/**
 * @author thinknovo
 * @version 1.0
 */
public class POIRead {
    // sheet页 row行 cell列
    public static String outputFile = "D:\\IdeaProjects\\j259ssm_userproject\\src\\main\\java\\com\\gxa\\j259\\user\\poi\\test2.xls";
    public static void main(String[] args) throws IOException {
        FileInputStream fOut = new FileInputStream(outputFile);             // 创建一个文件输出流
        HSSFWorkbook workbook = new HSSFWorkbook(fOut);
        HSSFSheet sheet = workbook.getSheet("第一个sheet");                // 获取分页
//        HSSFRow row = sheet.getRow(0);                              // 获取这页的第1行(0代表第一行)
//        HSSFCell cell_id = row.getCell(0);                           // 通过指定的行，得到指定的列(列从0开始)
//        HSSFCell cell_username = row.getCell(1);
//        HSSFCell cell_password = row.getCell(2);
//        System.out.println(cell_id);
//        System.out.println(cell_username);
//        System.out.println(cell_password);


        HSSFRow row = sheet.getRow(4);
        HSSFCell cell_username = row.getCell(0);
        HSSFCell cell_password = row.getCell(1);
        System.out.println(cell_username);
        System.out.println(cell_password);


    }
}
